class EoSS_GamePlayerController extends GamePlayerController;

var float PreDist;

simulated event PostBeginPlay() //This event is triggered when play begins
{
	super.PostBeginPlay();
	`Log("I am alive!"); //This sends the message "I am alive!" to thelog (to see the log, you need to run UDK with the -log switch)
}
//Functions for zooming in and out
exec function NextWeapon() /*The "exec" command tells UDK to ignore what the defined function of NextWeapon is, and use our function declaration here.
We'll go over how to change the function of keys later (if, for instance, you didn't want you use the scroll wheel, but page up and down for zooming instead.)*/
{
if (PlayerCamera.FreeCamDistance < 64) //Checks that the the value FreeCamDistance, which tells the camera how far to offset from the view target, isn't further than we want the camera to go. Change this to your liking.
	{
		`Log("MouseScrollDown"); //Another log message to tell us what's happening in the code
		PlayerCamera.FreeCamDistance += 32*(PlayerCamera.FreeCamDistance/256); /*This portion increases the camera distance.
By taking a base zoom increment (64) and multiplying it by the current distance (d) over 256, we decrease the zoom increment for when the camera is close,
(d < 256), and increase it for when it's far away (d > 256).
Just a little feature to make the zoom feel better. You can tweak the values or take out the scaling altogether and just use the base zoom increment if you like */
	}
}
exec function PrevWeapon()
{
	if (PlayerCamera.FreeCamDistance > 16) //Checking if the distance is at our minimum distance
	{
		`Log("MouseScrollUp");
		PlayerCamera.FreeCamDistance -= 32*(PlayerCamera.FreeCamDistance/256); //Once again scaling the zoom for distance
	}
}

exec function ShoulderCam() // Declaring our ShoulderCam function that we bound to
{
	`Log("Shoulder Camera"); // Yet another log...
	PreDist = PlayerCamera.FreeCamDistance; //Storing our previous camera distance...
	EoSS_Camera(PlayerCamera).CameraStyle = 'ShoulderCam'; //Type casting our camera script to access the variable CameraStyle
}

exec function ReturnCam() //This is called on release of left shift
{
	`Log("Main Camera");
	PlayerCamera.FreeCamDistance = PreDist; // Restoring the previous camera distance
	EoSS_Camera(PlayerCamera).CameraStyle = 'FreeCam'; // Restoring the previous camera style
}

DefaultProperties
{
	CameraClass = class 'EoSS_Camera' //Telling the player controller to use your custom camera script
	DefaultFOV=90.f //Telling the player controller what the default field of view (FOV) should be
}